package com.easy.query.demo.config;

import com.easy.query.core.api.client.EasyQueryClient;
import com.easy.query.demo.anno.Id4Trans;
import com.easy.query.demo.extend.EasyQueryTransDiver;
import com.fhs.core.trans.util.ReflectUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * create time 2023/9/22 22:39
 * 文件说明
 *
 * @author xuejiaming
 */
@Slf4j
@Configuration
public class EasyTransEasyQueryConfig implements InitializingBean {

    @Autowired
    private EasyQueryClient easyQueryClient;

    @Bean
    public EasyQueryTransDiver easyQueryTransDiver() {
        EasyQueryTransDiver result = new EasyQueryTransDiver(easyQueryClient);
        return result;
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        ReflectUtils.ID_ANNO.add(Id4Trans.class);
    }
}
